home *** CD-ROM | disk | FTP | other *** search
/ Softwarová Záchrana 3 / Softwarova-zachrana-3.bin / Xteq X-Setup / xqdcXSP-Setup-EN.exe / {app} / plugins / XQ App Paths.xpl < prev    next >
Text File  |  2000-12-21  |  5KB  |  173 lines

  1. "FILE"="Xteq Systems X-Setup Plugin 5.0"
  2. "TYPE"="8"
  3. "COUNT"="3"
  4. "UIPATH"="System\File System\App Paths"
  5. "NAME"="App Paths Editor"
  6. "VERSION"="2.02"
  7. "LANGUAGE"="VBScript"
  8. "TEXT 1"="Edit..."
  9. "TEXT 2"="Add new..."
  10. "TEXT 3"="Delete"
  11. "DESCRIPTION 1"="If you would like to start a program e.g. "MYAPP.exe" Windows first search the current WINDOWS and WINDOWS\SYSTEM folder for this file."
  12. "DESCRIPTION 2"="If it's not found, Windows will continue to search for it in the %PATH% variable and if it's still not found, searches this list."
  13. "DESCRIPTION 3"="If the EXE name is found, Windows will simply execute what you have configured, even if it's a total different file."
  14. "DESCRIPTION 4"="Just edit the existing entries to your needs or add a new one, e.g. for some DOS tools you might have."
  15. "COMMENT 1"=" "
  16. "AUTHOR"="Xteq Systems"
  17. "CONTACTURL"="http://www.xteq.com"
  18. "COPYRIGHT"="Copyright ⌐ Xteq Systems - All Rights Reserved"
  19.  
  20.  
  21. 'Declaration of some constants
  22. sP="HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\"
  23. sV1="\@"
  24. sV2="\Path"
  25.  
  26. Dim iCount
  27. Dim aryLoc()
  28.  
  29. 'Called when the Plugin is started
  30. SUB Plugin_Initialize
  31.  'empty list
  32.  For l=1 to iCount
  33.      Call SetUIElement(l,"")
  34.  next
  35.  
  36.  'read again
  37.  iCount=RegEnumPaths(sP)
  38.  
  39.  if iCount>0 then
  40.     'redim array
  41.     ReDim aryLoc(iCount)
  42.  
  43.     for l=1 to iCount
  44.         s=RegEnumElement(l)
  45.         aryLoc(l)=s
  46.  
  47.         's=sP & RegEnumElement(l) & sV1
  48.         's=RegReadValue(s)
  49.         Call SetUIElement(l,s)
  50.     next
  51.  else
  52.     Disable
  53.  end if
  54. END SUB
  55.  
  56. 'Called when the Plugin should validate the Data the user has entered
  57. SUB Plugin_CheckData(ElementIndex)
  58. END SUB
  59.  
  60. 'Called when the Plugin should apply the changes
  61. SUB Plugin_Apply(ElementIndex,ElementSubIndex)
  62.  If ElementIndex=2 then 'Add new
  63.     sNewName=InputWindow("Add Item: Please name the EXE file e.g. MYTOOL.exe","",1) 
  64.     if IsEmpty(sNewName)=false then
  65.        sNewPath=InputWindow("Add Item: Enter full path for the EXE file e.g. C:\TOOLS\mytool.exe)",sNewName,1) 
  66.             
  67.        if IsEmpty(sNewPath)=false then
  68.           Call RegWriteValue(sP & sNewName & sV1,sNewPath,1)
  69.           Call Plugin_Initialize()
  70.           Call MsgInformation("New item added")
  71.        end if
  72.    end if
  73.  
  74.  else
  75.  
  76.  
  77.    if ElementSubIndex>0 then 'OK, user has selected an item 
  78.        Select Case ElementIndex
  79.        Case 1 'Edit existing one
  80.             sName=aryLoc(ElementSubIndex)
  81.             sPath=RegReadValue(sP & sName & sV1)
  82.             
  83.             if len(sPath)=0 then 
  84.                'oops, this one seems to use the PATH option
  85.                sPath=RegReadValue(sP & sName & sV2)
  86.             end if
  87.          
  88.             sNew=InputWindow("Change EXE command for selected item (use a full path e.g. C:\TOOLS\mytool.exe)",sPath,1) 
  89.             if IsEmpty(sNew)=false then
  90.                Call RegWriteValue(sP & sName & sV1,sNew,1)
  91.                Call MsgInformation("EXE command changed to " & sNew)
  92.             end if
  93.  
  94.        Case 3 'DELETE
  95.             sName=aryLoc(ElementSubIndex)
  96.             Call RegDeleteValue(sP & sName & sV1)   
  97.             Call RegDeletePath(sP & sName)   
  98.             Call Plugin_Initialize()
  99.             Call MsgInformation("Item removed...")
  100.             
  101.        End Select
  102.    else
  103.        Call MsgWarning("No item selected - please select an item first.")
  104.    end if
  105.  
  106.  
  107.  end if
  108. END SUB
  109.  
  110. 'Called when the Plugin is about to be removed from memory
  111. SUB Plugin_Terminate
  112. END SUB
  113.  
  114. Sub Blah
  115.    If a=1 then 
  116.  
  117.       s=sp & aryLoc(ElementSubIndex) & sV1
  118.       sV=RegReadValue(s) 
  119.   
  120.  
  121.        if true then
  122.           'change it!
  123.           Call RegWriteValue(s,sV,1)          
  124.           Call SetUIElement(ElementSubIndex,sV)   
  125.        end if 
  126.  
  127.    else
  128.     if ElementIndex=3 then  'Delete!!
  129.  
  130.        'Create name of first value
  131.        t=sp & aryLoc(ElementSubIndex) ' "& sV1" removed here, and 's' renamed to 't'
  132.  
  133.        ' Start of new code added by Neil Turner <totalxs@hotmail.com>
  134.        iCount=RegEnumValues(t) ' Enumerate all values
  135.        For u=1 to iCount
  136.            s=RegEnumElement(u) ' Get one of the values...
  137.            s=t & "\" & s ' Get full path of value...
  138.            Call RegDeleteValue(s) ' ... and delete it!
  139.        Next
  140.    
  141.        If IsEmpty(t & "\@")=true then
  142.           Call RegDeletePath(t) ' Finally, delete key!
  143.        else
  144.           If IsEmpty(t & "\@")=true then
  145.              Call RegDeleteValue(t & "\@") ' Otherwise, remove (Default) and then delete key. IsEmpty test is carried out twice - otherwise X-Setup produces an error (don't know why).
  146.           end if
  147.           Call RegDeletePath(t)
  148.        end if
  149.        
  150.  
  151.  ' End of new code
  152.        
  153.  
  154.        'Set item to empty so it is removed from the list...
  155.        Call SetUIElement(ElementSubIndex,"")
  156.  
  157.     else 'Edit command
  158.  
  159.        s=sp & aryLoc(ElementSubIndex) & sV2
  160.        sV=RegReadValue(s) 
  161.   
  162.        sV=InputWindow("Change Uninstall Command",sV,1)
  163.        if IsEmpty(sV)=false then
  164.           'change it!
  165.           Call RegWriteValue(s,sV,1)
  166.        end if 
  167.  
  168.     end if
  169.    end if
  170.  
  171.  
  172.  
  173. End Sub